<section class="content-header">
 <h1>Edit api</h1>
</section>
<section class="content">
 <!-- /.row -->
 <div class="row">
  <div class="col-xs-12">
   <div class="box box-primary">
     <div class="box-body">
      <div class="form-group">
       <label>Request uri</label>
       <input type="text" class="form-control" name="request_uri" placeholder="Request uri">
      </div>
      <div class="form-group">
       <label>Original uri</label>
       <input type="text" class="form-control" name="original_uri" placeholder="The backend service's uri">
      </div>
      <div class="form-group">
       <label >uri description</label>
       <input type="text" class="form-control" name="description" placeholder="uri description">
      </div>
     </div>
     <!-- /.box-body -->
     <div class="box-footer">
      <button id="edit-api-btn" class="btn btn-primary">Edit</button>
      <button class="btn btn-default" onclick="load_page('/pages/api/list.html');">Cancel</button>
     </div>
   </div>
   <!-- /.box -->
  </div>
 </div>
</section>
<script type="text/javascript">
      $(".content-header h1").html(domain_name+" > "+service_name+" > Edit service uri")
      $("#edit-api-btn").click(function(){
      var params = {api_id:api_id,request_uri:$("input[name='request_uri']").val(),original_uri:$("input[name='original_uri']").val(),description:$("input[name='description']").val()};
        api_invoke("/api/v1/api/edit", params, function(data){
            if(data.errno == 0){
                load_page("/pages/api/list.html");
            }else{
                alert(data.msg);
            }
        });
      });
        $(function(){
          api_invoke("/api/v1/api/get", {api_id:api_id}, function(data){
            if(data.errno == 0){
                $("input[name='request_uri']").val(data.info.request_uri);
                $("input[name='original_uri']").val(data.info.original_uri);
                $("input[name='description']").val(data.info.description);
            }else{
                alert(data.msg);
            }
          });
        });
</script>